using ASP;
using HoWave.Web;
using HoWave.Web.Admin;
using System;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.WebControls;
public class HL_Admin_Admin_ProductAttributesList : Admin, IRequiresSessionState
{
	protected DropDownList DropDownList_Attributes;
	protected LinkButton LinkButton_Add;
	protected GridView GridView_Attributes;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!base.IsPostBack)
		{
			this.DdlAttributes();
			if (base.Request.QueryString["Type"] == null)
			{
				this.AttributesListBind("");
			}
			else
			{
				string text = base.Request.QueryString["Type"].ToString();
				this.DropDownList_Attributes.Items.FindByText(text).Selected = true;
				this.AttributesListBind(text);
			}
		}
	}
	protected void DdlAttributes()
	{
		Shop_ProductAttributes shop_ProductAttributes = new Shop_ProductAttributes();
		this.DropDownList_Attributes.DataSource = shop_ProductAttributes.GetAllAttributesType();
		this.DropDownList_Attributes.DataBind();
		this.DropDownList_Attributes.Items.Insert(0, new ListItem("全部", ""));
	}
	protected void AttributesListBind(string strType)
	{
		Shop_ProductAttributes shop_ProductAttributes = new Shop_ProductAttributes();
		this.GridView_Attributes.DataSource = shop_ProductAttributes.GetAttributesNameByAttributesType(strType);
		this.GridView_Attributes.DataBind();
	}
	protected void DropDownList_Attributes_SelectedIndexChanged(object sender, EventArgs e)
	{
		this.AttributesListBind(this.DropDownList_Attributes.SelectedValue);
	}
	protected void GridView_Attributes_RowCommand(object sender, GridViewCommandEventArgs e)
	{
		Shop_ProductAttributes shop_ProductAttributes = new Shop_ProductAttributes();
		if (e.CommandName == "_Delete")
		{
			bool flag = shop_ProductAttributes.DeleteAttributes(Convert.ToInt32(e.CommandArgument), "");
			if (flag)
			{
				this.WriteSuccessMsg("", "删除成功！", "Admin_ProductAttributesList.aspx");
			}
		}
	}
	protected void LinkButton_Add_Click(object sender, EventArgs e)
	{
		base.Response.Redirect("Admin_ProductAttributesEdit.aspx?Model=_Add&&TypeName=" + this.DropDownList_Attributes.SelectedValue);
	}
}
